package com.kunbo.cn.entity.system;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Entity
@Table(name="sys_depart")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
@EntityListeners(AuditingEntityListener.class)
public class Depart implements Serializable{/** serialVersionUID*/
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(generator = "jpa-uuid")
    @Column(length = 32)
	private String id;//主键uuid
	private String name;//部门名称
	private String des;//描述
	private String pid;//父节点id
	@Transient
	private List<Depart> children; //父节点的子类
	@CreatedDate
    private Date createTime;//创建时间
    @LastModifiedDate
    private Date lastModifiedTime;//修改时间
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDes() {
		return des;
	}
	public void setDes(String des) {
		this.des = des;
	}
	public String getPid() {
		return pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	public List<Depart> getChildren() {
		return children;
	}
	public void setChildren(List<Depart> children) {
		this.children = children;
	}
	@Override
	public String toString() {
		return "Depart [id=" + id + ", name=" + name + ", des=" + des + ", pid=" + pid + ", children=" + children
				+ ", createTime=" + createTime + ", lastModifiedTime=" + lastModifiedTime + "]";
	}
	
	

}
